<template>
  <div>
    <el-table v-loading="loading" :data="grybList" stripe>
      <el-table-column type="index" width="50"></el-table-column>
      <el-table-column prop="nickName" label="昵称"></el-table-column>
      <el-table-column label="头像" width="100">
        <template slot-scope="scope">
          <img :src="scope.row.avatarUrl" alt height="50" />
        </template>
      </el-table-column>
      <el-table-column prop="totalPoints" label="积分"></el-table-column>
    </el-table>
  </div>
</template>

<script>
import { fetchList, del } from "@/api/userlist";
import scroll from "@/utils/scroll";
export default {
  data() {
    return {
      grybList: [],
      count: 50,
      loading: false, //加载动画
      delDialogVisible: false, //删除的对话框是否显示
    };
  },
  created() {
    this.getList();
  },
  mounted() {
    scroll.start(this.getList);
  },
  methods: {
    getList() {
      fetchList({
        start: this.grybList.length,
        count: this.count,
      }).then((res) => {
        console.log(res);
        this.grybList = this.grybList.concat(res.data);
        for (var i = 0; i < this.grybList.length; i++) {
          if (this.grybList[i].level) {
            this.grybList[i].level = "是";
          } else {
            this.grybList[i].level = "否";
          }
        }
        if (res.data.length < this.count) {
          scroll.end();
        }
        this.loading = false;
      });
    },
  },
};
</script>

<style>
</style>